package de.kimera.model;

import java.util.LinkedList;
import java.util.List;

import de.kimera.api.IEmployee;
import de.kimera.api.IServicePlan;
import de.kimera.api.IShift;
import de.kimera.api.ITableOfHours;

public class TableOfHours implements ITableOfHours {

	private IEmployee employee;
	private List<IShift> shifts;
	private IServicePlan servicePlan;
	
	public TableOfHours(IEmployee employee) {
		this.employee = employee;
		this.shifts = new LinkedList<IShift>();
	}

	@Override
	public IEmployee getEmployee() {
		return employee;
	}

	@Override
	public IServicePlan getServicePlan() {
		return servicePlan;
	}

	@Override
	public List<IShift> getShifts() {
		return shifts;
	}

	@Override
	public void setEmployee(IEmployee employee) {
		this.employee = employee;
	}

	@Override
	public void setServicePlan(IServicePlan servicePlan) {
		this.servicePlan = servicePlan;
	}

	@Override
	public void addShift(IShift shift) {
		shifts.add(shift);
		
		//maintain bidirectional reference
		shift.setTableOfHours(this);
	}
}
